function sendTrigger(event,initStr)

global iOObj;
global iOObjParam;

% triggerport initialization
if nargin==2 ,
    if strcmpi(initStr,'DIO'), % DIO 
        iOObj = digitalio('mcc',0);
        addline(iOObj,0:3,'out');
        iOObjParam.address = 0;
    else % parallel port
        iOObjParam.address = hex2dec(str2double(initStr));
        %create IO32 interface object
        iOObj = io32();
        % %install the inpout32.dll driver. Status = 0 if installation successful
        iOStatus = io32(iOObj);
        if(iOStatus ~= 0)
            disp('parallel port inp/outp installation failed!');
            errordlg('Parallel port inp/outp installation failed!','Trigger port Error');
            iOObj=-1;
        else
            io32(iOObj,address,0);
        end        
    end
end

if iOObjParam.address==0, %DIO
    putvalue(iOObj,event);
    pause(0.01);
    putvalue(0);
else % parallel port
    io32(iOObj,iOObjParam.address,event);
    pause(0.01);
    io32(iOObj,iOObjParam.address,0);
end